package com.example.allplan.Activity;

import android.content.Context;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.allplan.JavaBean.YiGeQianJavaBean;
import com.example.allplan.R;
import com.example.allplan.RecyclerAdapter.QianLieBiaoAdapter;
import com.example.allplan.ShuJuKuCaoZuo.YiGeChouQianSQCaoZuo;

import java.util.ArrayList;
import java.util.Collections;

public class ChouQianXianShiActivity extends BaseActivity  {
        Toolbar mtoolbar;
        RecyclerView mrecyclerview;
        QianLieBiaoAdapter madapter;
        ArrayList<YiGeQianJavaBean> mlist;
        String wen_jian_ming,biao_ti_ming;
        YiGeChouQianSQCaoZuo msqcaozuo;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.chou_qian_xian_shi_activity_layout);
        init();
    }
    void init(){
        wen_jian_ming=getIntent().getStringExtra("wen_jian_ming");
        biao_ti_ming=getIntent().getStringExtra("ming_cheng");
        msqcaozuo=new YiGeChouQianSQCaoZuo(this,wen_jian_ming);
        mtoolbar=findViewById(R.id.chou_qian_jie_guo_toolbar);
        setSupportActionBar(mtoolbar);
        mtoolbar.setTitle(biao_ti_ming);
        mlist=msqcaozuo.reloadAllChouQianTiaoWenHao();
        mrecyclerview=findViewById(R.id.chou_qian_jie_guo_tiao_mu_recyclerview);
        madapter=new QianLieBiaoAdapter(mlist, new QianLieBiaoAdapter.onItemClickListener() {
            @Override
            public void onClick(int pos, Context mcon) {
                mlist.get(pos).setXian_shi(0);
                madapter.notifyItemChanged(pos);
            }
        },this);
        Collections.shuffle(mlist);
        mrecyclerview.setAdapter(madapter);
        mrecyclerview.setLayoutManager(new LinearLayoutManager(this));
    }


}
